<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%
	String path = request.getContextPath();
%>

<form id="pagerForm" onsubmit="return navTabSearch(this);" action="repayment/getRenewalCheckPage?myId=${params.myId}" method="post">
	<div class="pageHeader">
		<div class="searchBar">
			<table class="searchContent">
				<tr>
					<td>
						手机:
						<input type="text" name="phone" id="xq_phone"
							   value="${params.phone }" />
					</td>
					<td>
						续期时间:
						<input type="text" name="orderTime" id="xq_orderTime"
							   class="date textInput readonly" datefmt="yyyy-MM-dd" readonly="readonly"
							   value="${params.orderTime}" />-
						<input type="text" name="orderTimeEnd" id="xq_orderTimeEnd"
							   class="date textInput readonly" datefmt="yyyy-MM-dd" readonly="readonly"
							   value="${params.orderTimeEnd}" />	   
					</td>
					
					<td>
						放款账户:
						<select id="xq_capitalType" name="capitalType">
							<option value="">全部</option>
							<option <c:if test="${params.capitalType == 1}"> selected </c:if> value="1">上海鱼耀金融信息服务有限公司</option>
							<option <c:if test="${params.capitalType == 2}"> selected </c:if> value="2">杭州招财猫网络科技有限公司</option>
						</select>
					</td>
					<td>
						续期方式:
						<select id="xq_renewalType" name="renewalType">
							<option value="">全部</option>
							<option <c:if test="${params.renewalType eq 1}"> selected </c:if> value="1">富友</option>
							<option <c:if test="${params.renewalType eq 2}"> selected </c:if> value="2">支付宝</option>
							<option <c:if test="${params.renewalType eq 3}"> selected </c:if> value="3">未知渠道</option>
						</select>
					</td>
					<td>
						订单号:

							<input type="text" name="xq_orderId" id="orderId"  value="${params.orderId }" />
					</td>
					<td>
						<div class="buttonActive">
							<div class="buttonContent">
								<button type="submit">
									查询
								</button>
							</div>
						</div>
					</td>
				</tr>
			</table>
		</div>
	</div>
	<div class="pageContent">
		<jsp:include page="${BACK_URL}/rightSubList">
			<jsp:param value="${params.myId}" name="parentId"/>
		</jsp:include>
		<table class="table" style="width: 100%;" layoutH="112" nowrapTD="false">
			<thead>
				<tr>
					<th align="center"  >
						序号
					</th>
					<th align="center"  >
						用户ID
					</th>
					<th align="center" >
						用户姓名
					</th>
					<th align="center"  >
						手机号
					</th>
					<th align="center" >
						还款Id
					</th>
					<th align="center"  >
						订单ID
					</th>
					<th align="center" >
						总还款金额
					</th>
					<th align="center" >
						已还款金额
					</th>
					<th align="center" >
						服务费
					</th>
					<th align="center" >
						续期天数
					</th>
					<th align="center">
					        续期费
					</th>
					<th align="center">
					        退款金额
					</th>
					<th align="center" >
					       续期前应还时间
					</th>
					<th align="center" >
						续期后应还时间
					</th>
					<th align="center"  >
						续期方式
					</th>
					<th align="center"  >
						续期状态
					</th>
					<th align="center"  >
						续期时间
					</th>
					<th align="center"  >
						放款账户
					</th>
				</tr>
				
			</thead>
			<tbody>
				<c:forEach var="renewal" items="${pm.items }" varStatus="status">
					<tr target="renewalId">
						<td>
							${status.count}
						</td>
						<td>
							${renewal.userId}
						</td>
						<td>
							${renewal.realname}
						</td>
						<td>
							${renewal.phone }
						</td>
						<td>
							${renewal.reapymentId }
						</td>
						<td>${repayment.orderId}</td>
						<td>
							<fmt:formatNumber pattern='###,###,##0.00' value="${renewal.repaymentAmount / 100.00}"/>
						</td>
						<td>
							<fmt:formatNumber pattern='###,###,##0.00' value="${renewal.repaymentedAmount / 100.00}"/>
						</td>
						<td>
							<fmt:formatNumber pattern='###,###,##0.00' value="${renewal.repaymentInterest / 100.00}"/>
						</td>
						<td>
						   ${renewal.renewalDay} 
						</td>
						<td>
							<fmt:formatNumber pattern='###,###,##0.00' value="${renewal.trueRepaymentMoney / 100.00}"/>
						</td>
						<td>
							<fmt:formatNumber pattern='###,###,##0.00' value="${renewal.returnMoney / 100.00}"/>
						</td>
						<td>
							<fmt:formatDate value="${renewal.oldRepaymentTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
						</td>
						<td>
							<fmt:formatDate value="${renewal.repaymentTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
						</td>
                        <td>
						<%--	<c:choose>
							   <c:when test="${renewal.renewalType == 1}">融宝</c:when>
							   <c:when test="${renewal.renewalType == 2}">支付宝</c:when>
							    <c:when test="${renewal.renewalType == 3}">未知渠道</c:when>
							</c:choose>--%>
							<c:choose>
								<c:when test="${renewal.remark == 'RONGBAO'}">融宝</c:when>
								<c:when test="${renewal.remark == 'BAOFOO'}">宝付</c:when>
							</c:choose>

						</td>
						<td>
							<c:choose>
							   <c:when test="${ renewal.status == 1}">续期成功</c:when>
							   <c:when test="${renewal.status == 5}"> 已还款,未确认退款</c:when>
							</c:choose>
							${BACK_REPAY_STATUS[renewal.status]}
						</td>
						<td>
							<fmt:formatDate value="${renewal.orderTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
						</td>
						<td>
							${LOAN_ACCOUNTMap[renewal.capitalType]}
						</td>
						
					</tr>
				</c:forEach>
			</tbody>
		</table>
		<c:set var="page" value="${pm }"></c:set>
		<%@ include file="../page.jsp"%>
	</div>
</form>

<script type="text/javascript">
	/* $(function(){
		var $statuses = $("#statuses");
		$statuses.bind("change", function(){
			if($statuses.val() == '-11'){
				$("#overdueStatusTd").show();
			}
			else{
				$("#overdueStatusTd").hide();
				$("#overdueStatus").val("");
			}
		});
		$statuses.trigger("change");
	}); */
	function changeXQExcel(obj){
		var orderTimeEnd = $("#xq_orderTimeEnd").val();
		var orderTime=$("#xq_orderTime").val();
      /*   debugger;
		if(!orderTimeEnd || !orderTime){
			alertMsg.warn("请选择导出时间");
			return;
		} */
		var href=$(obj).attr("href");
		var phone=$("#xq_phone").val();
		var capitalType=$("#xq_capitalType").val();
		var renewalType=$("#xq_renewalType").val();
		var orderId  = $("#xq_orderId").val();
		var toHref = href + "&phone=" + phone + "&orderTime=" + orderTime 
		             + "&orderTimeEnd="+orderTimeEnd+ "&capitalType=" + capitalType
		             +"&renewalType="+renewalType
		             +"&orderId="+orderId;
		$(obj).attr("href",toHref);
		return true;
	}
</script>